package com.resign.carl.iterator.api.impl;

import com.google.common.collect.Lists;
import com.resign.carl.iterator.api.Menu;
import com.resign.carl.iterator.entity.MenuItem;

import java.util.List;
import java.util.Iterator;

/**
 * Created by carl.zhao on 2016/6/16.
 */
public class PancakeHouseMenu implements Menu<MenuItem> {

    private List<MenuItem> menuItems;

    public PancakeHouseMenu(){
        menuItems = Lists.newArrayList();
        addItem("hahahaha", "hahahaha", true, 2.99);
        addItem("hohohoho", "hohohoho", true, 3.99);
        addItem("hehehehe", "hehehehe", true, 3.29);
        addItem("xixixixi", "xixixixi", true, 1.99);
        addItem("xoxoxoxo", "xoxoxoxo", true, 1.38);
        addItem("xexexexe", "xexexexe", true, 5.01);
    }

    public Iterator<MenuItem> createIterator(){
        return menuItems.iterator();
    }

    private void addItem(String name, String desc, boolean vegetarian, double price){
        MenuItem menuItem = new MenuItem(name, desc, vegetarian, price);
        menuItems.add(menuItem);
    }
}
